'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller } = app;
  // 上传
  router.post('/api/upload/file', controller.uploadcos.file);
  // 登录
  router.post('/api/user/login', controller.user.login);
  router.post('/api/user/wxH5login', controller.user.wxH5login);
  router.post('/api/user/register', controller.user.create);
  router.resources('user', '/api/user', controller.user);
  // banner
  router.get('/api/banner/list', controller.banner.allList);
  router.resources('banner', '/api/banner', controller.banner);
  // config
  router.get('/api/config/list', controller.config.allList);
  router.resources('config', '/api/config', controller.config);
  // group
  router.get('/api/group/list', controller.group.allList);
  router.resources('group', '/api/group', controller.group);
  // vote
  router.get('/api/vote/list', controller.vote.allList);
  router.resources('vote', '/api/vote', controller.vote);
  // record
  router.get('/api/record/list', controller.record.allList);
  router.resources('record', '/api/record', controller.record);

  // weixin/wxConfig
  router.get('/api/weixin/wxConfig', controller.wx.wxConfig);
};
